<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        //vue2 的响应原理
        //defineProperty的属性存储符
        //Obeject.defindeProperty(劫持的对象,劫持的属性,选项)
        //数据劫持
        const data ={
            name:"包子",
            age:30,
            say(){
                console.log("我饿了")
            }
        };

        Object.defineProperty(data,"name",{
            enumerable:true,
            configurable:true,
            get(){
                console.log("name属性被访问了");
                return 0;
            },
            set(val){
                console.log("name被设置成"+"&"+val+"&")
            }
        })
    </script>
</body>
</html>